package com.deyuanyun.pic.ctrl.controller.dto;

import com.alibaba.fastjson.annotation.JSONField;
import com.deyuanyun.pic.common.util.StringUtils;
import com.deyuanyun.pic.common.util.poi.annotation.ExcelWriteColumn;
import com.deyuanyun.pic.ctrl.enumeration.ExceptionHandlingStateEnum;
import com.deyuanyun.pic.settings.support.utils.BaseCodeUtils;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
 *  阴保测试桩运行记录展示dto
 *  @author axiao(xj08.dream@gmail.com)
 *  @date 2016-09-18
 *  @version 1.0
 *  Histroy: [修改人][时间][描述]
 */
public class RecodeCpTestStationDTO {


    private String id;

    /**
     * 设备编号
     */
    @ExcelWriteColumn
    private String customNumber;

    private String cptestStationId;

    /**
     * 自然电位
     */
    @ExcelWriteColumn
    public Long freeCorrosionPotential;

    /**
     * 通电电位
     */
    @ExcelWriteColumn
    public Long onPotential;

    /**
     * 断电/极化电位
     */
    @ExcelWriteColumn
    public Long offPotential;

    /**
     * 交流电压（V）
     */
    @ExcelWriteColumn
    private BigDecimal acInterferenceVoltage;

    /**
     * 完好情况FINE_STATUS
     */
    @ExcelWriteColumn
    private String testStationFineStatus;

    /**
     * 测试桩维护
     */
    @ExcelWriteColumn
    private String pileMaintenance;

    /**
     * 是否有异常
     */
    private boolean hasException;

    /**
     * 异常编号（若无异常则为空）PIC_CTRL_RECODE_EXCEPTION.ID_
     */
    private String exceptionId;

    /**
     * 异常记录
     */
    @ExcelWriteColumn
    private String exceptionRecord;

    /**
     * 异常状态
     */
    private String exceptionStated;

    /**
     * 处理记录
     */
    @ExcelWriteColumn
    private String treatRecord;

    /**
     * 记录人（直接存名称）
     */
    @ExcelWriteColumn
    private String recorder;

    /**
     * 记录时间
     */
    @ExcelWriteColumn
    private Date recordTime;

    /**
     * 备注
     */
    @ExcelWriteColumn
    private String remarks;

    private String imagePath; //图片路径，数据库返回使用，前台不需要

    private List<String> imagePaths; //图片路径集合，前台需要的

    @JSONField(serialize = false)
    public String getImagePath() {
        return imagePath;
    }

    public void setImagePath(String imagePath) {
        this.imagePath = imagePath;
    }

    public List<String> getImagePaths() {
        if(StringUtils.isNotEmpty(imagePath)) {
            return Arrays.asList(imagePath.split(","));
        }
        return imagePaths;
    }

    public void setImagePaths(List<String> imagePaths) {
        this.imagePaths = imagePaths;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCustomNumber() {
        return customNumber;
    }

    public void setCustomNumber(String customNumber) {
        this.customNumber = customNumber;
    }

    public String getCptestStationId() {
        return cptestStationId;
    }

    public void setCptestStationId(String cptestStationId) {
        this.cptestStationId = cptestStationId;
    }

    public Long getFreeCorrosionPotential() {
        return freeCorrosionPotential;
    }

    public void setFreeCorrosionPotential(Long freeCorrosionPotential) {
        this.freeCorrosionPotential = freeCorrosionPotential;
    }

    public Long getOnPotential() {
        return onPotential;
    }

    public void setOnPotential(Long onPotential) {
        this.onPotential = onPotential;
    }

    public Long getOffPotential() {
        return offPotential;
    }

    public void setOffPotential(Long offPotential) {
        this.offPotential = offPotential;
    }

    public BigDecimal getAcInterferenceVoltage() {
        return acInterferenceVoltage;
    }

    public void setAcInterferenceVoltage(BigDecimal acInterferenceVoltage) {
        this.acInterferenceVoltage = acInterferenceVoltage;
    }

    public String getTestStationFineStatus() {
        return BaseCodeUtils.getName(testStationFineStatus);
    }

    public void setTestStationFineStatus(String testStationFineStatus) {
        this.testStationFineStatus = testStationFineStatus;
    }

    public String getPileMaintenance() {
        return pileMaintenance;
    }

    public void setPileMaintenance(String pileMaintenance) {
        this.pileMaintenance = pileMaintenance;
    }

    public boolean isHasException() {
        return hasException;
    }

    public void setHasException(boolean hasException) {
        this.hasException = hasException;
    }

    public String getExceptionId() {
        return exceptionId;
    }

    public void setExceptionId(String exceptionId) {
        this.exceptionId = exceptionId;
    }

    public String getExceptionRecord() {
        return exceptionRecord;
    }

    public void setExceptionRecord(String exceptionRecord) {
        this.exceptionRecord = exceptionRecord;
    }

    public String getExceptionStated() {
        if(StringUtils.isNotEmpty(exceptionStated))
            return ExceptionHandlingStateEnum.valueOf(exceptionStated).getLabel();
        return null;
    }

    public void setExceptionStated(String exceptionStated) {
        this.exceptionStated = exceptionStated;
    }

    public String getTreatRecord() {
        return treatRecord;
    }

    public void setTreatRecord(String treatRecord) {
        this.treatRecord = treatRecord;
    }

    public String getRecorder() {
        return recorder;
    }

    public void setRecorder(String recorder) {
        this.recorder = recorder;
    }

    public Date getRecordTime() {
        return recordTime;
    }

    public void setRecordTime(Date recordTime) {
        this.recordTime = recordTime;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }
}
